package edu.bbu.commonproject.desktop.gui.view.swing.file;

import java.awt.BorderLayout;

import javax.swing.ImageIcon;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;

import edu.bbu.commonproject.desktop.gui.view.swing.login.LogoPanel;
import edu.bbu.commonproject.desktop.gui.view.swing.utils.Design;

/**
 * The header file list panel.
 */
public class HeaderFileListPanel extends JPanel 
{
	/** The menu bar. */
	private JMenuBar menuBar;
	
	/** The application menu. */
	private JMenu applicationMenu;
	
	/** The action menu. */
	private JMenu actionsMenu;
	
	/** The option menu. */
	private JMenu optionsMenu;
	
	/** The help menu. */
	private JMenu helpMenu;
	
	/** The logout menu item. */
	private JMenuItem logoutMenuItem;
	
	/** The exit menu item. */
	private JMenuItem exitMenuItem;
	
	/** The upload menu item. */
	private JMenuItem uploadMenuItem;
	
	/** The download menu item. */
	private JMenuItem downloadMenuItem;
	
	/** The stat synchronize menu item. */
	private JMenuItem startSyncMenuItem;
	
	/** The synchronize setup menu item. */
	private JMenuItem syncSetupsMenuItem;
	
	/** The privacy setup menu item. */
	private JMenuItem privacySetupsMenuItem;
	
	/** The help menu item. */
	private JMenuItem helpMenuItem;
	
	/** The about menu item. */
	private JMenuItem aboutMenuItem;

	/** The logo file list panel. */
	private LogoFileListPanel logoFileListPanel;

	/**
	 * The constructor.
	 */
	public HeaderFileListPanel() 
	{
		this.setLayout(new BorderLayout());
		setComponents();
	}

	/**
	 * Sets up the components.
	 */
	private void setComponents() 
	{
		menuBar = new JMenuBar();
		
		applicationMenu = new JMenu("Application");
		actionsMenu = new JMenu("Actions");
		optionsMenu = new JMenu("Setups");
		helpMenu = new JMenu("Help");
		
		Design.setMenuSelectedLook(applicationMenu);
		Design.setMenuSelectedLook(actionsMenu);
		Design.setMenuSelectedLook(optionsMenu);
		Design.setMenuSelectedLook(helpMenu);
		
		
		logoutMenuItem = new JMenuItem("  Logout", new ImageIcon(Design.MENU_LOGOUT));
		exitMenuItem = new JMenuItem("  Exit", new ImageIcon(Design.MENU_CLOSE));
		
		uploadMenuItem = new JMenuItem("  Upload selected", new ImageIcon(Design.MENU_UPLOAD));
		downloadMenuItem = new JMenuItem("  Download selected", new ImageIcon(Design.MENU_DOWNLOAD));
		startSyncMenuItem = new JMenuItem("  Synchronize", new ImageIcon(Design.MENU_SYNC));
		
		syncSetupsMenuItem = new JMenuItem("  Sync setups", new ImageIcon(Design.MENU_SYNCSSETUP));
		privacySetupsMenuItem = new JMenuItem("  Privacy setups", new ImageIcon(Design.MENU_PRIVACY));

		helpMenuItem = new JMenuItem("  Help", new ImageIcon(Design.MENU_HELP));
		aboutMenuItem = new JMenuItem("  About", new ImageIcon(Design.MENU_ABOUT));

		Design.setMenuItemSelectedLook(logoutMenuItem);
		Design.setMenuItemSelectedLook(exitMenuItem);
		Design.setMenuItemSelectedLook(uploadMenuItem);
		Design.setMenuItemSelectedLook(downloadMenuItem);
		Design.setMenuItemSelectedLook(startSyncMenuItem);
		Design.setMenuItemSelectedLook(syncSetupsMenuItem);
		Design.setMenuItemSelectedLook(privacySetupsMenuItem);
		Design.setMenuItemSelectedLook(helpMenuItem);
		Design.setMenuItemSelectedLook(aboutMenuItem);

		applicationMenu.add(logoutMenuItem);
		applicationMenu.add(exitMenuItem);
		
		actionsMenu.add(uploadMenuItem);
		actionsMenu.add(downloadMenuItem);
		actionsMenu.addSeparator();
		actionsMenu.add(startSyncMenuItem);
		
		optionsMenu.add(syncSetupsMenuItem);
		optionsMenu.add(privacySetupsMenuItem);
		
		helpMenu.add(helpMenuItem);
		helpMenu.add(aboutMenuItem);
		
		menuBar.add(applicationMenu);
		menuBar.add(actionsMenu);
		menuBar.add(optionsMenu);
		menuBar.add(helpMenu);
		
		logoFileListPanel = new LogoFileListPanel();

		this.add(menuBar, BorderLayout.NORTH);
		this.add(logoFileListPanel, BorderLayout.CENTER);
	}
	
	/**
	 * Gets the logo file list panel.
	 * @return the logo file list panel.
	 */
	public LogoFileListPanel getLogoFileListPanel()
	{
		return logoFileListPanel;
	}
	
	/**
	 * Gets the logo menu item.
	 * @return the logo menu item.
	 */
	public JMenuItem getLogoutMenuItem()
	{
		return logoutMenuItem;
	}
	
	/**
	 * Get the exit menu item.
	 * @return the exit menu item.
	 */
	public JMenuItem getExitMenuItem()
	{
		return exitMenuItem;
	}

	/**
	 * Gets the uploaad menu iem.
	 * @return the menu item.
	 */
	public JMenuItem getUploadMenuItem()
	{
		return uploadMenuItem;
	}
	
	/**
	 * Gets the download menu item.
	 * @return the download menu item.
	 */
	public JMenuItem getDownloadMenuItem()
	{
		return downloadMenuItem;
	}
	
	/**
	 * Gets the start synchronize menu item.
	 * @return the start synchronize menu item.
	 */
	public JMenuItem getStartSyncMenuItem()
	{
		return startSyncMenuItem;
	}
	
	/**
	 * Gets the setup synchronize menu item.
	 * @return the setup synchronize menu item.
	 */
	public JMenuItem getSyncSetupsMenuItem()
	{
		return syncSetupsMenuItem;
	}
	
	/**
	 * Gets the privacy setup menu item.
	 * @return the privacy setup menu item.
	 */
	public JMenuItem getPrivacySetupsMenuItem()
	{
		return privacySetupsMenuItem;
	}
	
	/**
	 * Gets the help menu item.
	 * @return the help menu item.
	 */
	public JMenuItem getHelpMenuItem()
	{
		return helpMenuItem;
	}
	
	/**
	 * Gets the about menu item.
	 * @return the about menu item.
	 */
	public JMenuItem getAboutMenuItem()
	{
		return aboutMenuItem;
	}
}
